package com.abluedog.c1;

import java.nio.ByteBuffer;

import static com.abluedog.util.ByteBufferUtil.debugAll;

public class ReadByteBufferTest {
    public static void main(String[] args) {
        ByteBuffer byteBuffer = ByteBuffer.allocate(10);
        byteBuffer.put(new byte[]{1,2,3,4,5,6,7,8,9,10});
        byteBuffer.flip();

        byteBuffer.get(new byte[4]);
        debugAll(byteBuffer);

        byteBuffer.rewind();

        debugAll(byteBuffer);
        byteBuffer.mark();
        byteBuffer.get(new byte[4]);
        debugAll(byteBuffer);
        byteBuffer.reset();
        debugAll(byteBuffer);
    }
}
